<template>
	<div class="full-screen">
		<div class="full-screen-content">
			<div class="ScreenViewManageEdit-drag-common-img"
				 :style="{'background-color':screenConfig.globalConfig.background!='color'?screenConfig.globalConfig:''}">
				<img v-if="screenConfig.globalConfig.background=='system' &&screenConfig.globalConfig.mode=='dark'"
					 class="system-img"
					 :src="getImage('image/background/dark'+screenConfig.globalConfig.bgImage+'.png')"/>
				<img
					v-if="screenConfig.globalConfig.background=='system' &&screenConfig.globalConfig.mode=='bright'"
					class="system-img"
					:src="getImage('image/background/light'+screenConfig.globalConfig.bgImage+'.png')"/>
				<img v-else-if="screenConfig.globalConfig.background=='custom'" class="system-img"
					 :src="getFilePath(screenConfig.globalConfig.customImage)" alt="photo"/>
			</div>
			<div @click="minification" class="full-screen-shrink"><rx-icon-show icon="icon-linenarrow"></rx-icon-show></div>
			<div
				:class="[borderShow(fullScreen.config.styles.background) || fullScreen.config.styles.mode =='material' ||  fullScreen.type== 'iconfont' ?'rx-dragList-common':'rx-dragList-common-system']"
				:style="getStyle(fullScreen.config.styles,fullScreen.type)">
				<!-- 控件内容-->
				<component :is="fullScreen.type+'-view'"
						   style="z-index:1;position: absolute;"
						   :ref="fullScreen.id"
						   :screenView="screenView"
						   :screenConfig="screenConfig"
						   :config="fullScreen.config"
                           :loadView="loadView"
				></component>
			</div>
		</div>
	</div>
</template>

<script>
import {Util,TokenUtil} from "@lowcode/jpaas-base-lib";
import previewComponents from "@/views/modules/preview/index.js";
export default {
	name: "FullScreen",
    mixins:[previewComponents],
	props:['screenConfig','fullScreenShow','fullScreen','screenView','loadView'],
	methods:{
		//判断是否展示边框
		borderShow(type){
			let list = ['none','color','custom'];
			if(list.indexOf(type)!=-1){
				return true
			}else {
				return false
			}
		},
		getStyle(type,rect) {
			if(rect == "image" || rect =="iconfont"){
				return
			}
			if (type.background == 'system') {
				//系统自定义
                let img =  import.meta.env.JPAAS_BASE_URL+'/image/background/border' + type.bgImage + '.png';
				const style = {borderImageSource: 'url(' + img + ')'};
				return style;
			} else if (type.background == 'custom') {
				//上传图片
				let img = this.getFilePath(type.customImage)
				const style = {backgroundImage: 'url(' + img + ')',backgroundSize:'100% 100%',padding:'0px 15px 15px 15px'};
				return style;
			} else if (type.background == 'color') {
				const style = {
					backgroundColor: type.customColor,
					border: this.initBorder(type),
					borderRadius: type.borderRadius + 'px',
					padding:'0px 15px 15px 15px'
				};
				return style;
			}
		},
		getFilePath(fileId) {
      let token = TokenUtil.getToken();
			fileId=Util.encryptWord(fileId);
			return "/api/api-system/system/core/sysFile/previewFile?fileId=" + fileId + "&accessToken=" + token;
		},
        getImage(url) {
            return import.meta.env.JPAAS_BASE_URL + '/' + url;
        },
		minification(){
			this.$emit('minification')
		},
		initBorder(type) {
			if (type.borderOpacity === 0) {
				return 'nome'
			} else {
                return  type.borderWidth + "px solid " +type.borderColor
			}
		}
	}
}
</script>

<style scoped>
.full-screen{
	background-color: rgba(0,0,0,.5);
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999;
	display: flex;
	align-items: center;
	justify-content: center;
}
.full-screen-shrink{
	font-weight: 400!important;
	height: 40px;
	width: 40px;
	display: inline-block;
	border-radius: 5px;
	text-align: center;
	line-height: 40px;
	position: absolute;
	top: 10px;
	right:10px;
	font-size: 22px;
	z-index: 999;
	cursor: pointer;
	background-color: #4285f4;
	color: white;
}
.full-screen-content{
	width: calc(100% - 40px);
	height: calc(100% - 40px);
	background-color: white;
	border-radius: 5px;
	padding: 20px;
	position: relative;
	overflow: hidden;
	border: 3px solid white;
}
.componentList-child-commom-list {
	display: flex;
	flex-wrap: wrap;
}

.componentList-child-commom-list-name {
	width: 69px;
	height: 63px;
	border-radius: 5px;
	margin-top: 10px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-items: center;
	margin-right: 10px;
	cursor: pointer;
}

.componentList-child-commom-list-name:hover {
	background-color: #eff5ff;
}

.componentList-child-commom-list-name i {
	font-size: 25px;
	color: #9cbff9;
	margin-top: 10px;
}

.componentList-child-commom-list-name span {
	font-size: 12px;
	color: #808080;
}

.componentList-child-commom-hend {
	height: 50px;
	line-height: 50px;
	color: #333333;
	font-size: 14px;
	border-bottom: 1px solid #dedede;
}

.componentList-child {
	width: 425px;
	min-height: 200px;
	max-height: 600px;
	overflow: auto;
	background-color: #ffffff;
	border: solid 1px #dedede;
	position: absolute;
	top: 63px;
	left: -170px;
	padding: 0px 20px 10px 20px;
	z-index: 10000;
	display: none;
}

.rx-dragList-common {
	width: 100%;
	height: 100%;
	padding: 0px!important;
}

.rx-dragList-common-system {
	width: 100%;
	height: 100%;
	border-image-slice: 15 fill;
	border-width: 15px;
	border-style: solid;
	overflow: hidden;
	background-clip: padding-box;
	filter: blur(0px
	);
}

.system-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}


.drawer-button i {
	color: #303030;
	margin-top: 17px;
	font-size: 20px;
}

.drawer-button span {
	color: #303030;
	font-size: 14px;
	display: block;
	line-height: 15px;
}

.right-design >>> .ant-drawer-body {
	padding: 0px 0px 20px 0px !important;
	overflow: hidden;

}
.right-design >>> .ant-tabs-tabpane-active{
	padding: 0px 20px;
}
.right-design >>> .ant-tabs-tabpane-active:nth-child(2){
	padding:0px 0px 0px 20px!important;
}

.ScreenViewManageEdit-drag-common-img {
	position: absolute;
	top: 0px;
	left: 0px;
	bottom: 0px;
	right: 0px;
	width: 100%;
	height: 100%;
}

.ScreenViewManageEdit-head-le img {
	width: 35px;
	margin-left: 14px;
}

.ScreenViewManageEdit-head-le span {
	font-size: 18px;
	color: #ffffff;
	margin-left: 10px;
}

</style>
